#pragma once
#include "IPAddress.h"
#include "array/Array.hpp"

namespace yzrilyzr_net{
    ECLASS(IP6Address, public IPAddress){
    protected:
    int64_t msb=0;  // 高64位
    int64_t lsb=0;  // 低64位

    public:
    IP6Address()=default;
    IP6Address(const yzrilyzr_array::ByteArray & fromBytes);
    IP6Address(int32_t maskLength, int64_t msb, int64_t lsb);

    int32_t hashCode() const override;
    bool operator==(const IP6Address & other) const;
    bool inRange(const IPAddress * targetRange) const override;

    yzrilyzr_lang::String toFullString() const override;
    yzrilyzr_lang::String toMaskedString() const override;
    yzrilyzr_lang::String toSimpleString() const override;

    std::shared_ptr<IPAddress> toMasked(int32_t maskLength) const override;
    std::shared_ptr<IPAddress> clone() const override;

    std::shared_ptr<yzrilyzr_array::ByteArray> toByte() const override;
    void fromByte(const yzrilyzr_array::ByteArray & b) override;

    int getVersion()const override;

    static std::shared_ptr<IP6Address> parse(const yzrilyzr_lang::String & str);

    // 静态常量
    static std::shared_ptr<IP6Address> LOCAL_HOST;
    static std::shared_ptr<IP6Address> ANY_ADDRESS;
    };
}